export interface CaptchaModel{
    captchaKey:string
    captchaValue:string
}

import { useGet, usePost } from '@/utils/request'

export async function getCaptcha() {
  return useGet<CaptchaModel>('/web/captcha')
}

export interface LoginParam{
    username:string
    password:string
    captchaKey:string
    captchaCode:string
}

export interface LoginResponse{
  tokenValue:string
}

export async function loginApi(param:LoginParam) {
  return usePost<LoginResponse>('/web/login',param)
}

export interface RegParam{
    email:string
    password:string
    confirmPsd:string
    code:string
}

export async function regApi(param:RegParam){
  return usePost('/web/reg',param)
}

export async function modifyPsdApi(param:RegParam){
  return usePut('/web/modifyPsd',param)
}

export async function sendCaptchaApi(email:string){
  return usePost('/web/sendCode',{email:email})
}
